﻿@{
    ViewBag.Title = "添加按钮";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model MenuDto           
<div class="row">
    @using (Html.BeginHBootstrap_Box("添加按钮"))
    {
        using (Html.BeginForm("AddButton", "Menu", FormMethod.Post, new { id = "postForm", @class = "form-horizontal", onsubmit = "return validateCallback(this,navTabAjaxDone)" }))
        {
         
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        <span class="text-danger">*</span>所属菜单：</label>
                    <div class="col-sm-8">
                        @Html.DropDownListFor(m => m.ParentId, Model.MenuList, new { @class = "form-control chosen-select" })
                        @Html.ValidationMessageFor(m => m.ParentId)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        <span class="text-danger">*</span>按钮名称：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.MenuName, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.MenuName)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        <span class="text-danger">*</span>Controller名称：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.ControllerName, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.ControllerName)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        <span class="text-danger">*</span>Action名称：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.ActionName, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.ActionName)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        图标：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.Icon, new { @class = "form-control" })
                        <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>常用图标fa【fa-search(查询),fa-plus(新增),fa-edit(编辑),fa-cut(删除),fa-cloud-download(下载),fa-cloud-upload(上传),fa-wrench(设置),fa-check(审核)】</span>
                        @Html.ValidationMessageFor(m => m.Icon)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        <span class="text-danger">*</span>按钮类型：</label>
                    <div class="col-sm-8">
                        @Html.DropDownListFor(m => m.ActionType, Model.ActionTypeList, new { @class = "form-control chosen-select" })
                        <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>只有按钮菜单才需要设置该选项
                        @Html.ValidationMessageFor(m => m.ActionType)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        <span class="text-danger">*</span>排序：</label>
                    <div class="col-sm-8">
                        @Html.TextBoxFor(m => m.Sort, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Sort)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-3">
                        <button class="btn btn-primary" type="submit">
                            提交</button>
                        <a class="btn btn-default" type="button" href="@Url.Action("Index", "Menu")" >取消</a>
                    </div>
                </div>
        }
    }
</div>
@section Customer_Js{
    <script type="text/javascript">
        $(function () {
            $('#ActionType').on("change", function () {
                $.ajax({
                    type: 'GET',
                    url: '@Url.Action("GetIconByActionType", "Menu")',
                    data: {actionType:$(this).val()},
                    cache: false,
                    success:function(data){
                        if (data) {
                            debugger;
                            $('#Icon').val(data);
                        }
                    },
                    error: BootStrapUI_Core.ajaxError
                });
            });
        });
    </script>
}
